<include file="Public/Header" />

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- operation start -->
		<div class="am-g">
			<button class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus submit-add" data-am-modal="{target: '#data-save-win'}"> {{:L('common_operation_add')}}</button>
		</div>
		<!-- operation end -->

		<!-- save win start -->
		<div class="am-popup am-radius" id="data-save-win">
			<div class="am-popup-inner">
				<div class="am-popup-hd">
					<h4 class="am-popup-title" data-add-title="{{:L('link_add_name')}}" data-edit-title="{{:L('link_edit_name')}}">{{:L('link_add_name')}}</h4>
					<span data-am-modal-close class="am-close">&times;</span>
				</div>
				<div class="am-popup-bd">
					<!-- form start -->
					<form class="am-form form-validation" action="{{:U('Admin/Link/Save')}}" method="POST" request-type="ajax-reload" request-value="">
						<div class="am-form-group">
							<label>{{:L('link_name_text')}}</label>
							<input type="text" placeholder="{{:L('link_name_text')}}" name="name" minlength="2" maxlength="16" data-validation-message="{{:L('link_name_format')}}" class="am-radius" required />
						</div>
						<div class="am-form-group">
							<label>{{:L('link_url_text')}}<span class="fs-12 fw-100 cr-999">（{{:L('link_url_text_tips')}}）</span></label>
							<input type="url" placeholder="{{:L('link_url_text')}}" name="url"  data-validation-message="{{:L('link_url_format')}}" class="am-radius" required />
						</div>
						<div class="am-form-group">
							<label>{{:L('common_view_sort_title')}}</label>
							<input type="number" placeholder="{{:L('common_view_sort_title')}}" name="sort" min="0" max="255" data-validation-message="{{:L('common_sort_error')}}" class="am-radius" value="0" required />
						</div>
						<include file="Lib/IsNewWindowOpen" />
						<include file="Lib/Enable" />
						<div class="am-form-group am-form-success">
							<label>{{:L('link_describe_text')}}</label>
							<textarea rows="3" maxlength="60" name="describe" class="am-radius" placeholder="{{:L('link_describe_text')}}" data-validation-message="{{:L('link_describe_format')}}"></textarea>
						</div>
						<div class="am-form-group">
							<input type="hidden" name="id" />
							<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}">{{:L('common_operation_save')}}</button>
						</div>
					</form>
					<!-- form end -->
				</div>
			</div>
		</div>
		<!-- save win end -->

		<!-- list start -->
		<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
			<thead>
				<tr>
					<th>{{:L('link_name_text')}}</th>
					<th class="am-hide-sm-only">{{:L('link_describe_text')}}</th>
					<th>{{:L('common_view_state_title')}}</th>
					<th>{{:L('common_operation_name')}}</th>
				</tr>
			</thead>
			<tbody>
				<if condition="!empty($list)">
					<foreach name="list" item="v">
						<tr id="data-list-{{$v.id}}" <if condition="$v['is_enable'] eq 0">class="am-active"</if>>
							<td>{{$v.name}}
								<a href="{{$v.url}}" target="_blank">
									<i class="am-icon-external-link"></i>
								</a>
							</td>
							<td class="am-hide-sm-only">{{$v.describe}}</td>
							<td>
								<a href="javascript:;" class="am-icon-btn am-icon-check submit-state <if condition="$v['is_enable'] eq 1">am-success<else />am-default</if>" data-url="{{:U('Admin/Link/StateUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}"></a>
							</td>
							<td>
								<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit submit-edit" data-am-popover="{content: '{{:L('common_operation_edit')}}', trigger: 'hover focus'}" data-am-modal="{target: '#data-save-win'}" data-json='{{:json_encode($v)}}'></button>
								<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/Link/Delete')}}" data-am-popover="{content: '{{:L('common_operation_delete')}}', trigger: 'hover focus'}" data-id="{{$v.id}}"></button>
							</td>
						</tr>
					</foreach>
				<else />
					<tr><td colspan="5" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
				</if>
			</tbody>
		</table>
		<!-- list end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
<include file="Public/Footer" />
<!-- footer end -->